package model

import (
	"manager/model/entity"
)

// CountryCreateRequest 创建现场数据
type CountryCreateRequest struct {
	CountryCode string `json:"country_code"`

	EnglishName string `json:"english_name"`

	ChineseName string `json:"chinese_name"`

	LocalName string `json:"local_name"`

	Location string `json:"location"`

	LocalLanguage string `json:"local_language"`

	LocalDialect string `json:"local_dialect"`

	UpdatedAt int64 `json:"updated_at"`
}

// CountryUpdateRequest 更新现场数据
type CountryUpdateRequest struct {
	Id int64 `json:"id"`

	CountryCode *string `json:"country_code"`

	EnglishName *string `json:"english_name"`

	ChineseName *string `json:"chinese_name"`

	LocalName *string `json:"local_name"`

	Location *string `json:"location"`

	LocalLanguage *string `json:"local_language"`

	LocalDialect *string `json:"local_dialect"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// CountryListRequest 列表现场数据
type CountryListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	CountryCode *string `json:"country_code"`

	EnglishName *string `json:"english_name"`

	ChineseName *string `json:"chinese_name"`

	LocalName *string `json:"local_name"`

	Location *string `json:"location"`

	LocalLanguage *string `json:"local_language"`

	LocalDialect *string `json:"local_dialect"`

	UpdatedAt *int64 `json:"updated_at"`
}

// CountryListResponse 列表回包数据
type CountryListResponse struct {
	Total int            `json:"total"`
	List  []*CountryInfo `json:"list"`
}

// CountryInfoRequest 列表现场数据
type CountryInfoRequest struct {
	Id int64 `json:"id"`

	CountryCode *string `json:"country_code"`

	EnglishName *string `json:"english_name"`

	ChineseName *string `json:"chinese_name"`

	LocalName *string `json:"local_name"`

	Location *string `json:"location"`

	LocalLanguage *string `json:"local_language"`

	LocalDialect *string `json:"local_dialect"`

	UpdatedAt *int64 `json:"updated_at"`
}

// CountryInfo 详细数据
type CountryInfo struct {
	Id int64 `json:"id"`

	CountryCode string `json:"country_code"`

	EnglishName string `json:"english_name"`

	ChineseName string `json:"chinese_name"`

	LocalName string `json:"local_name"`

	Location string `json:"location"`

	LocalLanguage string `json:"local_language"`

	LocalDialect string `json:"local_dialect"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// CountryDeleteRequest 删除现场数据
type CountryDeleteRequest struct {
	Id int64 `json:"id"`
}

// CountrysEntityToDto entity数据转换
func CountrysEntityToDto(countrys []*entity.Country) []*CountryInfo {
	out := make([]*CountryInfo, 0, len(countrys))
	for _, c := range countrys {
		out = append(out, CountryEntityToDto(c))
	}
	return out
}

// CountryEntityToDto entity数据转换
func CountryEntityToDto(e *entity.Country) *CountryInfo {
	return &CountryInfo{

		Id: e.Id,

		CountryCode: e.CountryCode,

		EnglishName: e.EnglishName,

		ChineseName: e.ChineseName,

		LocalName: e.LocalName,

		Location: e.Location,

		LocalLanguage: e.LocalLanguage,

		LocalDialect: e.LocalDialect,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
